//
//  Player.m
//  网络FM
//
//  Created by dlios on 15/5/25.
//  Copyright (c) 2015年 dengzhicheng.com. All rights reserved.
//

#import "Player.h"
#import <AudioStreamer.h>
#import <MediaPlayer/MediaPlayer.h>


//static AudioStreamer *audioPlayer = nil;

static Player *share = nil;

@implementation Player



+ (Player *)playManager
{
    static dispatch_once_t once;
    dispatch_once(&once, ^{
        if (!share) {
            share = [[Player alloc] init];
        }
    });
    
    return share;
}

- (void)playWithUrl:(NSURL *)url
{
    if ([self.str isEqualToString:[NSString stringWithFormat:@"%@",url]]){
 
    }
    else
    {
        
        [self.streamer stop];
        self.streamer = [[MPMoviePlayerController alloc] initWithContentURL:url];
        [self.streamer play];
        self.str = [NSString stringWithFormat:@"%@",url];
    }
}

- (void)pause
{
    if (self.streamer) {
        [self.streamer pause];
    }
}



- (void)stop
{
    if (self.streamer) {
        [self.streamer stop];
    }
}
@end
